<template>
  <div>
    <AAA></AAA>
  </div>
</template>

<script>
import { reactive, toRefs, provide } from 'vue'
import AAA from '@/views/a.vue'
export default {
  components: {
    AAA
  },
  setup () {
    const obj = reactive({
      name: 'zp',
      age: 18
    })
    // 把值传给后代组件
    provide('obj', obj)
    const setage = (val) => {
      obj.age = val
    }
    return {
      ...toRefs(obj),
      setage
    }
  }
}
</script>

<style>
</style>
